package com.sky.frame;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
//import java.util.ArrayList;

import javax.imageio.ImageIO;

import com.sky.base.BaseSwitch;

public class ImageController {
	
	private ImagePane panel;
	
	public ImageController(ImagePane panel){
		this.panel = panel;
		try {
			BufferedImage image = ImageIO.read(new File("D:\\1.jpg"));
			this.panel.setImage(image);
			this.panel.repaint();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}	
	
	public void expandImage(){
	//  panel.setImage(BaseSwitch.expandImage(panel.getImage()));
	
	//	panel.setImage(BaseSwitch.nearetExpand(panel.getImage(),
			//(int)(panel.getImage().getWidth()*1.5),(int)(panel.getImage().getHeight()*1.5)));
	
	//	panel.setImage(BaseSwitch.doubleLinerExpand(panel.getImage(),
			//(int)(panel.getImage().getWidth()*1.5),(int)(panel.getImage().getHeight()*1.5)));
	
	//	panel.setImage(BaseSwitch.randImage(panel.getImage(),15));
		
	//	ArrayList<BufferedImage> l = new ArrayList<>();
	//	for(int i = 0;i < 30;i++){
	//		l.add(BaseSwitch.randImage(panel.getImage(), 5));
	//	}
	//	panel.setImage(BaseSwitch.averageImage(l));
	//	panel.setImage(BaseSwitch.imageSub(panel.getImage(), BaseSwitch.randImage(panel.getImage(), 1)));
		
	//	panel.setImage(BaseSwitch.standIamge(panel.getImage()));
		
		panel.setImage(BaseSwitch.imageDivision(panel.getImage(),
				BaseSwitch.grayImage(panel.getImage().getWidth(),panel.getImage().getHeight())));
		panel.repaint();
	}
}
